package com.sat.seckill.controller;

import com.sat.common.entity.Result;
import com.sat.seckill.model.SeckillGoods;
import com.sat.seckill.service.SeckillService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("seckill")
public class SeckillGoodsController {

    @Autowired
    private SeckillService seckillService;
    /**
     * 根据秒杀时间来查询对应的商品
     * @return
     */
    @GetMapping("getbytime/{dateStr}")
    public Result getByTime(@PathVariable String dateStr){

        List<SeckillGoods> list=seckillService.getByTime(dateStr);
        return Result.OK(list);

    }
}
